package DataStructure.linear;

public class TowWayLinkListTest {
    public static void main(String[] args) {
        //创建双向链表对象
        TowWayLinkList<String> ll = new TowWayLinkList<>();
        //测试插入
        ll.insert("柳淇");
        ll.insert("琪琪");
        ll.insert("老白");
        ll.insert(1,"我爱你");

        for (String s : ll) {
            System.out.println(s);
        }

        System.out.println("----------------------------------");

        //测试获取
        String result = ll.get(1);
        System.out.println(result);
        //测试删除
        String removeresult = ll.remove(2);
        System.out.println(removeresult);
        System.out.println("----------------------------------");
        System.out.println("第一个元素:"+ll.getFirst());
        System.out.println("最后一个元素:"+ll.getLast());
        //测试清空
        ll.clear();
        System.out.println(ll.length());

    }
}
